import axios from "axios";

// Create an axios instance
export const request = axios.create({
  baseURL: "https://east.albion-online-data.com",
  timeout: 5000,
});

// 获取价格
export function getPrice({ item, hasRed = false, hasBlack = false }) {
  const noRed = [
    "Fort Sterling",
    "Lymhurst",
    "Bridgewatch",
    "Martlock",
    "Thetford",
  ];
  hasRed && noRed.unshift("Caerleon");
  hasBlack && noRed.push("Black Market");
  return request({
    url: `/api/v2/stats/prices/${item}?locations=${noRed.join(
      ","
    )}&qualities=1`,
    method: "get",
  });
}
